package com.mspbots.core.wise.model;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * @author billb
 */
@Data
@Accessors(chain = true)
@TableName(autoResultMap = true)
public class TenantTimeEntry extends TenantEntity {

    private Long cwUid;
    private Long cwTid;
    private LocalDateTime beginDate;
    private LocalDateTime endDate;
    private Double actualHours;
    private String description;
    private String updatedBy;
    private Long chargeToId;
    private Boolean resolutionFlag;

    private JsonNode extend;

    private LocalDateTime enteredDate;
    private LocalDateTime updateTime;
    private LocalDateTime syncTime;

    private transient Long tenantUserId;
    private transient String tenantUserName;
    private transient Boolean addToDetailDescriptionFlag;

    public String getTenantUserName() {
        return this.getExtend().findPath("member").findValue("name").asText();
    }

    public Boolean getAddToDetailDescriptionFlag() {
        return this.getExtend().findValue("addToDetailDescriptionFlag").asBoolean();
    }

}
